﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SurvivalStrategy
{
    //klasa obslugujaca wszystkie jednostki
    public class EntitiesManager
    {
        private Dictionary<int, Entity> entities;
        public Dictionary<int, Entity> Entities { get { return entities; } }

        public EntitiesManager()
        {
            entities = new Dictionary<int, Entity>();
            Modules.BehaviorModule.SetValues(this);
            Modules.ActionModule.SetValues(this);
            PlayerController.SetValues(this);
        }

        public void AddEntity(Entity entity)
        {
            entities.Add(entity.ID, entity);
        }

        public void SetController(int id, EntityController controller)
        {
            entities[id].SetController(controller);
        }

        public void Update()
        {
            foreach (Entity entity in entities.Values)
            {
                entity.Update();
            }
        }

        public Entity GetEntity(int id)
        {
            return entities[id];
        }
    }
}